﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tetris.Grid;
using Microsoft.Xna.Framework.Graphics;

namespace Tetris.Blocks
{
    public class Square : TetrisBlock
    {
        public Square(GridPosition baseGridPosition, Texture2D texture)
            : base(baseGridPosition, texture)
        {
        }

        public override void InitBlockPositions(GridPosition baseGridPosition, Texture2D texture)
        {
            if (NUM_ELEMENTS != 4)
                throw new Exception("Don't know how to build a Square Tetris Block that doesn't have 4 block elements.");

            m_blocks[0] = new Block(texture, baseGridPosition);
            m_blocks[1] = new Block(texture, baseGridPosition + new GridPosition(0, 1));
            m_blocks[2] = new Block(texture, baseGridPosition + new GridPosition(1, 0));
            m_blocks[3] = new Block(texture, baseGridPosition + new GridPosition(1, 1));
        }

        protected override bool CanFlip(BlockGrid blockGrid)
        {
            // don't ever need to flip a square
            return false;
        }
    }
}
